package com.lch.sort;

/**
 * @author 刘晨辉
 * @date 2021/10/2 10:05 上午
 */
public class SelectSort {
    public static void main(String[] args) {
        int[] a = new int[]{43, 5, 7, 3, 7, 3};

        for (int i = 0; i < a.length-1; i++) {
            int index = i;
            int j;
            for (j = i + 1; j < a.length; j++) {
                if (a[j] < a[i]) {
                    index = j;
                }
            }
            if (index == i) {
                continue;
            }
            SawpUtil.swap(a, i, index);
        }

        for (int i = 0; i < a.length; i++) {
            System.out.printf(a[i] + ",");
        }
    }
}
